package com.cssy.xxkj.logic.dao.impl;

import com.cssy.xxkj.logic.dao.LogicProductionReturnDAO;
import com.cssy.xxkj.logic.entity.LogicProductionReturnDO;
import com.plat.helper.SearchConditions;

import java.util.List;

import org.springframework.dao.DataAccessException;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

/**
 * 数据访问对象实现类
 * @since 2014-10-09
 */
public class LogicProductionReturnDAOImpl extends SqlMapClientDaoSupport implements LogicProductionReturnDAO {

    /**
     * 插入数据
     * @param logicProductionReturnDO
     * @return 插入数据的主键
     */
    public String insertLogicProductionReturnDO(LogicProductionReturnDO logicProductionReturnDO) throws DataAccessException {
        Object id = getSqlMapClientTemplate().insert("LogicProductionReturn.insert", logicProductionReturnDO);
        return (String) id;
    }

    /**
     * 统计记录数
     * @param logicProductionReturnDO
     * @return 查出的记录数
     */
    public Integer countLogicProductionReturnDOByExample(LogicProductionReturnDO logicProductionReturnDO) throws DataAccessException {
        Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicProductionReturn.countByDOExample", logicProductionReturnDO);
        return count;
    }

    /**
     * 更新记录
     * @param logicProductionReturnDO
     * @return 受影响的行数
     */
    public Integer updateLogicProductionReturnDO(LogicProductionReturnDO logicProductionReturnDO) throws DataAccessException {
        int result = getSqlMapClientTemplate().update("LogicProductionReturn.update", logicProductionReturnDO);
        return result;
    }

    /**
     * 获取对象列表
     * @param logicProductionReturnDO
     * @return 对象列表
     */
    @SuppressWarnings("unchecked")
    public List<LogicProductionReturnDO> findListByExample(LogicProductionReturnDO logicProductionReturnDO) throws DataAccessException {
        List<LogicProductionReturnDO> list = getSqlMapClientTemplate().queryForList("LogicProductionReturn.findListByDO", logicProductionReturnDO);
        return list;
    }

    /**
     * 根据主键获取logicProductionReturnDO
     * @param id
     * @return logicProductionReturnDO
     */
    public LogicProductionReturnDO findLogicProductionReturnDOByPrimaryKey(String id) throws DataAccessException {
        LogicProductionReturnDO logicProductionReturnDO = (LogicProductionReturnDO) getSqlMapClientTemplate().queryForObject("LogicProductionReturn.findByPrimaryKey", id);
        return logicProductionReturnDO;
    }

    /**
     * 删除记录
     * @param id
     * @return 受影响的行数
     */
    public Integer deleteLogicProductionReturnDOByPrimaryKey(String id) throws DataAccessException {
        Integer rows = (Integer) getSqlMapClientTemplate().delete("LogicProductionReturn.deleteByPrimaryKey", id);
        return rows;
    }

	@Override
	public List<LogicProductionReturnDO> find(SearchConditions scs)
			throws DataAccessException {
		List<LogicProductionReturnDO> list = getSqlMapClientTemplate().queryForList("LogicProductionReturn_ex.find", scs);
        return list;
	}

	@Override
	public Integer count(SearchConditions scs) throws DataAccessException {
		Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicProductionReturn_ex.count", scs);
        return count;
	}

	@Override
	public Integer deleteBizRemoved(String id) throws DataAccessException {
		Integer rows = (Integer) getSqlMapClientTemplate().delete("LogicProductionReturn_ex.deleteBizRemoved", id);
        return rows;
	}

}